package com.yanqu.road.entity.activity.springunionbanquet.config;

import com.yanqu.road.entity.activity.ActivityConfig;
import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.enums.eActivityConfigType;
import com.yanqu.road.utils.string.StringUtils;

import java.util.List;
import java.util.Map;

public class SpringUnionBanquetConfig {


    List<SpringUnionBanquetAwardInfo> awardInfoList;

    ActivityInfo activityInfo;

    int foodOutTime;

    int itemId1;

    int itemId2;

    String text;

    int footLimit;

    List<Integer> conditionRestDayList;

    public ActivityInfo getActivityInfo() {
        return activityInfo;
    }

    public int getActivityId(){
        if(this.activityInfo == null){
            return 0;
        }
        return activityInfo.getActivityId();
    }

    public SpringUnionBanquetAwardInfo getSpringUnionBanquetAwardInfo(int dishId){
        for (SpringUnionBanquetAwardInfo awardInfo : awardInfoList) {
            if(dishId == awardInfo.getDishId()){
                return awardInfo;
            }
        }
        return null;
    }

    public SpringUnionBanquetConfig(ActivityInfo activityInfo) {
        this.activityInfo = activityInfo;
    }

    public List<SpringUnionBanquetAwardInfo> getAwardInfoList() {
        return awardInfoList;
    }

    public void setAwardInfoList(List<SpringUnionBanquetAwardInfo> awardInfoList) {
        this.awardInfoList = awardInfoList;
    }

    public void init(Map<String, ActivityConfig> activityConfigMap) {

        foodOutTime = activityConfigMap.get(eActivityConfigType.TUSU_FOOD_TIME.getName()).getIntValue();
        itemId1 = activityConfigMap.get(eActivityConfigType.TUSU_ITEMID1.getName()).getIntValue();
        itemId2 = activityConfigMap.get(eActivityConfigType.TUSU_ITEMID2.getName()).getIntValue();
        //text = activityConfigMap.get(eActivityConfigType.TUSU_TEXT.getName()).getValue();
        //footLimit = activityConfigMap.get(eActivityConfigType.TUSU_FOOD_LIMIT.getName()).getIntValue();
        conditionRestDayList = StringUtils.stringToIntegerList(activityConfigMap.get(eActivityConfigType.TUSU_RESET.getName()).getValue(), "\\|");
    }

    public int getFoodOutTime() {
        return foodOutTime;
    }

    public int getItemId1() {
        return itemId1;
    }

    public int getItemId2() {
        return itemId2;
    }

    public String getText() {
        return text;
    }

    public int getFootLimit() {
        return footLimit;
    }

    public List<Integer> getConditionRestDayList() {
        return conditionRestDayList;
    }

    public void setConditionRestDayList(List<Integer> conditionRestDayList) {
        this.conditionRestDayList = conditionRestDayList;
    }
}
